# 定义一个空的字典dic = {}
# dic['name'] = 'zhangsan'dic['age'] = 20print(dic)
# 给字典赋初始值dic2 = {'name':'lisi','age':18,'height':'180cm'}
# 获取单个值 通过key值获取  dic['name']print(dic2['name'])
# keys() 获得字典的所有keyprint(dic2.keys())
# values() 获取字典所有的value值print(dic2.values())
# 通过dict()构造函数创建字典dic3 = dict([('html',1),('java',2),('python',3)])print(dic3)
# 字典遍历，遍历的是字典的key值for i in dic3:    print(i,dic3[i])# 字典的另一种取值方式# get(key,default) 根据key值取出对应value值，# 如果key值不存在，则返回default值print(dic3.get("python","c++值不存在"))
